<?php

class wms_finder_expressadjust
{

	var $column_edit = '操作';
	var $column_edit_width = "50";

    var $detail_expressadjust_delis = "发货单明细";
	public function column_edit($row)
	{
		$finder_id = $_GET['_finder']['finder_id'];

        $expressadjustMdl = app::get('wms')->model('expressadjust');
        $expressadjust_datas= $expressadjustMdl->getList('status', array('id' => $row['id'] ),0,1);
        if($expressadjust_datas[0]['status']=='confirmed')
        {
            return '';
        }else
        {
        return '<a href="index.php?app=wms&ctl=admin_expressadjust&act=editexpressadjust&id=' . $row['id'] . '&finder_id='.$finder_id.'" target="_blank">编辑</a>';
        }
	}

    /*
     * 备货通知单明细
     */
    function detail_expressadjust_line($row)
    {
      
        $render = app::get('wms')->render();
        $sql="SELECT e.delivery_bn,os.order_bn,li.* 
            from sdb_wms_delivery e 
            left join sdb_ome_shop f on e.shop_id = f.shop_id 
            left JOIN sdb_ome_delivery od on ( e.outer_delivery_bn = od.delivery_bn ) 
            left JOIN sdb_ome_delivery_order odo on ( od.delivery_id = odo.delivery_id ) 
            left JOIN sdb_ome_orders os on (odo.order_id = os.order_id) 
            left join sdb_wms_expressadjust_line li on e.delivery_id=li.delivery_id 
            where li.expressadjust_id=".$row;

        $db=kernel::database();
        $basicMaterialInfo=$db->select($sql);  
        $render->pagedata['res'] = $basicMaterialInfo;
        return $render->fetch('admin/expressadjust/expressadjust_line.html');
    }

    /*
     * 备货通知单明细
     */
    // function detail_expressadjust_ax($row){
    //     $render = app::get('wms')->render();
    //     $expressadjust_delis = app::get('wms')->model('expressadjust_delis');
    //     $basicMaterialInfo = $expressadjust_delis->getList('*', array('expressadjust_id' => $row));
    //     $render->pagedata['res'] = $basicMaterialInfo;
    //     return $render->fetch('admin/expressadjust/expressadjust_ax.html');
    // }
}